home *** CD-ROM | disk | FTP | other *** search
- # You should avoid calling any of these procs:
- # They are slower, and may be removed at some point in the future.
- #
- # Some of these are currently called from Alpha's main menus. This
- # will be changed in the future, so that this entire file can vanish.
-
- # just wrappers around other procs
-
- if {[info exists warningForObsoleteProcedures] && ($warningForObsoleteProcedures == 1)} {
- # To help ensure Alpha(tk) doesn't need anything from here.
- if {[askyesno "Some code requires [array names unknown_pending]; please\
- try to remove that dependence on deprecated procedures. Throw an error?"] == "yes"} {
- error "Code required [array names unknown_pending]"
- }
- }
-
- proc realMenuName {name} {
- global subMenuInfo
- return [lindex $subMenuInfo($name) 1]
- }
- proc rebuildSimpleFilesetMenus {} {
- global gfileSets
- eval [menu::makeFlagMenu choose list currFileSet]
- Menu -n hideFileset -m -p filesetMenu::hideOrShow [lsort [array names gfileSets]]
- filesetUtilsMarksTicks
- }
-
- proc killWindowStatus {} { closeAWindow }
- proc chooseWindowStatus {} { chooseAWindow }
-
- proc sPromptChoices {msg def choices} {
- uplevel 1 prompt::fromChoices [list $msg $def -list $choices]
- }
-
- proc sPrompt {msg def} {
- global useStatusBar
- if {!$useStatusBar} {return [prompt $msg $def]}
- if {[catch {statusPrompt "$msg ($def): "} ans]} {
- error "cancel"
- }
- if {![string length $ans]} {return $def}
- return $ans
- }
-
- # This is superceded by more general completion/prompt routines which
- # do the same thing when told to use '-command winNames'.
- proc winComp {curr c} {
- if {$c != "\t"} {return $c}
-
- set matches {}
- foreach w [winNames] {
- if {[string match "$curr*" $w]} {
- lappend matches $w
- }
- }
- if {![llength $matches]} {
- error "No match"
- } else {
- return [string range [largestPrefix $matches] [string length $curr] end]
- }
- return ""
- }
-
- namespace eval file {}
- namespace eval help {}
-
- proc file::searchAndHyperise {args} { uplevel 1 win::searchAndHyperise $args }
- proc file::multiSearchAndHyperise {args} { uplevel 1 win::multiSearchAndHyperise $args }
- proc file::jumpToCode {args} { uplevel 1 win::jumpToCode $args }
-
- proc file::hyperHelpFileOpen { name } {
- help::openGeneral $name
- }
- proc file::hyperOpen {name} {
- help::openHyper $name
- }
-
- proc file::hyperHelpOpen { name } {
- help::openGeneral $name
- }
- proc file::hyperExampleOpen {{f ""}} {
- help::openExample $f
- }
-
- proc openFolder {args} {
- uplevel 1 file::showInFinder $args
- }
- proc pushMark {} {pushPosition}
- proc popMark {} {popPosition}
- proc pushPosition {args} {uplevel placeBookmark $args}
- proc popPosition {args} {uplevel returnToBookmark $args}
- proc absolutePath {filename} {file::absolutePath $filename}
- proc openFileQuietly {filename} {
- edit -c -w $filename
- }
- proc searchInFile {filename searchString {indices 0}} {
- file::searchFor $filename $searchString $indices
- }
-
- proc readFile {fileName} {file::readAll $fileName}
- proc writeFile {filename {text {}} {overwrite 0}} {
- file::writeAll $filename $text $overwrite
- }
- proc gotoFileLine {fname line {mesg {}}} {
- file::gotoLine $fname $line $mesg
- }
-
- proc buildSubMenu {args} {
- eval menu::buildHierarchy $args
- }
-
- proc listSubfolders {folder {depth 3}} {
- file::hierarchy $folder $depth
- }
-
- proc getIncludeFiles {} { optClickTB_List }
- proc editIncludeFile {item} { optClickTB_Pick $item}
- proc tryElseDump {name script} {
- try::level \#0 $script -reporting log -while $name
- }
- proc text::genericIndent {} { ::indentLine }
-
- proc revertTheseFiles {flist} {eval file::revertThese $flist}
-
- proc file::commentTextBlock {args} { eval comment::TextBlock $args }
- proc commentLine {args} { uplevel 1 comment::Line $args }
- proc uncommentLine {args} { uplevel 1 comment::undoLine $args }
- proc commentBox {args} { uplevel 1 comment::Box $args }
- proc uncommentBox {args} { uplevel 1 comment::undoBox $args }
- proc commentCharacters {args} { uplevel 1 comment::Characters $args }
- proc commentGetRegion {args} { uplevel 1 comment::GetRegion $args }
- proc commentSameStart {args} { uplevel 1 comment::SameStart $args }
- proc commentTextBlock {args} { uplevel 1 comment::TextBlock $args }
- proc commentGetFillLines {args} { uplevel 1 comment::GetFillLines $args }
- proc commentParagraph {args} { uplevel 1 comment::Paragraph $args }
- proc uncommentParagraph {args} { uplevel 1 comment::undoParagraph $args }
- proc fillParagraph {args} {uplevel 1 paragraph::fill $args}
- proc fillOneParagraph {args} {uplevel 1 paragraph::fillOne $args}
- proc paraStart {args} {uplevel 1 paragraph::start $args}
- proc paraFinish {args} {uplevel 1 paragraph::finish $args}
- proc sentenceParagraph {args} {uplevel 1 paragraph::sentence $args}
- proc selectParagraph {args} {uplevel 1 paragraph::select $args}
- proc addArrDef {args} { uplevel 1 prefs::addArrayElement $args }
- proc removeArrDef {args} { uplevel 1 prefs::removeArrayElement $args }
- proc addDef {args} {uplevel 1 prefs::add $args}
- proc removeDef {args} {uplevel 1 prefs::remove $args}
- proc readDefs {args} {uplevel 1 prefs::_read $args}
- proc writeDefs {args} {uplevel 1 prefs::_write $args}
- proc addArr {args} { uplevel 1 prefs::addArray $args }
- proc removeArr {args} { uplevel 1 prefs::removeArray $args }
- proc saveModifiedVars {args} { uplevel 1 prefs::saveModified $args }
- proc alpha::readUserDefs {} {uplevel 1 prefs::readAll}
- proc alpha::readUserPrefs {} {uplevel 1 prefs::tclRead}
- proc addUserLine {args} { uplevel 1 prefs::tclAddLine $args}
- namespace eval mode {}
- proc mode::addUserLine {args} {uplevel 1 prefs::tclAddModeLine $args}
- proc getSavedSettings {} {prefs::listAllSaved}
-
- proc upBrowse {} { browse::Up }
- proc downBrowse {} { browse::Down }
- proc gotoMatch {} { browse::Goto }
-
- proc stripNameCount str { win::StripCount $str }
-
- ########################################
- # #
- # A few random lisp'ish functions. #
- # #
- ########################################
-
- proc car {l} {lindex $l 0}
- proc cadr {l} {lindex $l 1}
- proc caddr {l} {lindex $l 2}
- proc cadddr {l} {lindex $l 3}
- proc caddddr {l} {lindex $l 4}
- proc cdr {l} {lrange $l 1 end}
- proc cddr {l} {lrange $l 2 end}
-
- proc mapcar args {return [eval map $args]}
-
- proc map {func l} {
- set out {}
- foreach el $l {
- lappend out [eval $func [list $el]]
- }
- return $out
- }
-
- proc cons {e l} {concat [list $e] $l}
-
- # ◊◊◊◊ Legacy TclAE Definitions ◊◊◊◊ #
-
- ##
- # -------------------------------------------------------------------------
- #
- # "aebuild::*" --
- #
- # Wrapper routines for tclAE::build::*. Don't call these in new code.
- #
- # -------------------------------------------------------------------------
- ##
-
- namespace eval aebuild {}
-
- proc aebuild::result {args} {
- return [eval tclAE::build::resultData $args]
- }
-
- proc aebuild::objectProperty {process property object} {
- return [tclAE::build::objectProperty $process $property $object]
- }
-
- proc aebuild::coercion {type value} {
- return [tclAE::build::coercion $type $value]
- }
-
- proc aebuild::list {l args} {
- return [eval tclAE::build::List [list $l] $args]
- }
-
- proc aebuild::hexd {value} {
- return [tclAE::build::hexd $value]
- }
-
- proc aebuild::bool {val} {
- return [tclAE::build::bool $val]
- }
-
- proc aebuild::TEXT {str} {
- return [tclAE::build::TEXT $str]
- }
-
- proc aebuild::alis {path} {
- return [tclAE::build::alis $path]
- }
-
- proc aebuild::fss {value} {
- return [tclAE::build::fss $value]
- }
-
- proc aebuild::name {name} {
- return [tclAE::build::name $name]
- }
-
- proc aebuild::filename {name} {
- return [tclAE::build::filename $name]
- }
-
- proc aebuild::winByName {name} {
- return [tclAE::build::winByName $name]
- }
-
- proc aebuild::winByPos {absPos} {
- return [tclAE::build::winByPos $absPos]
- }
-
- proc aebuild::lineRange {absPos1 absPos2} {
- return [tclAE::build::lineRange $absPos1 $absPos2]
- }
-
- proc aebuild::absPos {posName} {
- return [tclAE::build::absPos $posName]
- }
-
- proc aebuild::startupDisk {} {
- return [tclAE::build::startupDisk]
- }
-
- proc aebuild::userName {} {
- return [tclAE::build::userName]
- }
-
-
- namespace eval aeparse {}
-
- proc aeparse::event {chars args} {
- return [eval tclAE::parse::event [list $chars] $args]
- }
-
- proc aeparse::keywordValue {keyword record {typed 0}} {
- if {$typed} {
- return [tclAE::getKeyDesc $record $keyword]
- } else {
- return [tclAE::getKeyData $record $keyword]
- }
- }
-
-
- namespace eval aecoerce {}
-
- proc aecoerce::identity {value} {
- return $value
- }
-
- proc aecoerce::hexd:bool {value} {
- binary scan $value c bool
-
- if {![info exists bool]
- || ($bool != 0 && $bool != 1)} {
- error::throwOSErr -1700
- }
-
- return $bool
- }
-
- proc aecoerce::hexd:TEXT {value} {
- binary scan $value a* TEXT
- return $TEXT
- }
-
- proc aecoerce::hexd {value} {
- error "I have no idea what this is supposed to do"
- }
-
- proc aecoerce::null:TEXT {value} {
- return [tclAE::coerce::null>hexd $value]
- }
-
- proc aecoerce::hexd:alis {value} {
- set resultDesc [tclAE::createDesc alis]
- tclAE::coerce::TEXT>alis TEXT $value alis $resultDesc
- set result [tclAE::print $resultDesc]
- tclAE::disposeDesc $resultDesc
-
- return $result
- }
-
- proc aecoerce::TEXT:alis {value} {
- return [aecoerce::hexd:alis [binary format a* $value]]
- }
-
- proc aecoerce::register {args} {
- return [eval tclAE::installCoercionHandler $args]
- }
-
- proc aecoerce::apply {AEDesc toType} {
- set newDesc [tclAE::coerceDesc $AEDesc $toType]
- set result [tclAE::getData $newDesc]
- tclAE::disposeDesc $newDesc
-
- return $result
- }
-
- proc aecoerce::deregister {hook {procname ""} args} {
- error "There is no way to make \[aecoerce::deregister\] compatible with modern TclAE. \
- The code must be changed to use \[tclAE::removeCoercionHandler\]"
- }
-
- # I don't believe these are used anywhere, but put them here
- # to avoid the 7.4b17 fiasco
-
- namespace eval tclAE {}
- namespace eval tclAE::coerce {}
-
- proc tclAE::coerce::null>TEXT {value} {
- return ""
- }
-
- ##
- # bool ::= bool(«00|01»)
- ##
- proc tclAE::coerce::_hexd>bool {value} {
- set value [tclAE::coerce::_long>hexd $value]
- set bool [expr {"0x$value"}]
- if {($bool != 0) && ($bool != 1)} {
- set msg "Can't coerce «$value» from 'hexd' to 'bool'"
- error $msg "" [list AECoerce -1700 $msg]
- }
- return $bool
- }
-
- proc tclAE::coerce::_****>hexd {value} {
- set newval $value
- if {[expr {[string length $newval] % 2}]} {
- # left pad with zero to make even number of digits
- set newval "0${newval}"
- }
- if {![is::Hexadecimal $newval]} {
- set msg "Non-hex-digit in «${value}»"
- error $msg "" [list AECoerce 6 $msg]
- } else {
- return ${newval}
- }
- }
-
- proc tclAE::coerce::_hexd>TEXT {value} {
- # make sure input is really hexd
- set value [tclAE::coerce::_****>hexd $value]
-
- set TEXT ""
- set length [string length $value]
- set i 0
- while {$i < $length} {
- append TEXT [uplevel 0 "set temp \\x[string range $value $i [incr i]]"]
- incr i
- }
- return $TEXT
- }
-
- proc tclAE::coerce::_long>hexd {value} {
- set newval [format "%08X" $value]
- return [tclAE::coerce::_****>hexd $newval]
- }
-
- proc tclAE::coerce::_shor>hexd {value} {
- set newval [format "%04X" $value]
- return [tclAE::coerce::_****>hexd $newval]
- }
-
- if {[info tclversion] < 8.0} {
- proc tclAE::coerce::_TEXT>hexd {value} {
- set length [string length $value]
- set hexd ""
- for {set i 0} {$i < $length} {incr i} {
- if {[set char [string index $value $i]] == "\x00"} {
- # scan doesn't work on \x00, so we handle it specially.
- append hexd "00"
- } else {
- scan $char "%c" char
- append hexd [format "%02X" $char]
- }
- }
-
- return $hexd
- }
- } else {
- proc tclAE::coerce::_TEXT>hexd {value} {
- binary scan $value H* hexd
- return $hexd
- }
- }
-
-
- # mtime doesn't understand hex notation,
- # so we force to decimal first
- proc tclAE::coerce::_hexd>ldt {hexd} {
- return [join [mtime [tclAE::coerce::hexd>long $hexd] short]]
- }
-
-